package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: xiaotutu
 * Date: 2023-10-31
 * Time: 21:06
 */

class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Animal eat() {
        System.out.println(this.name + "在吃饭");
        return null;
    }
}

class Dog extends Animal {
    public Dog(String name, int age) {
        super(name, age);
    }
    @Override
    public Dog eat() {
        System.out.println(this.name + "正在吃狗粮");
        return null;
    }
}


public class Test {
    public static void main(String[] args) {
        Dog dog = new Dog("花花", 3);
        dog.eat();
       /* Cat cat = new Cat("朵朵", 3);
        cat.eat();*/
    }
}


/*
class Cat extends Animal {
    public Cat(String name, int age) {
        super(name, age);
    }
    @Override
    public void eat() {
        System.out.println(this.name + "正在吃猫粮");
    }
}*/
